package heima3_2.cn.osc.hold;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import net.oschina.app.R;

import butterknife.Bind;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;
import heima3_2.cn.osc.base.BaseHolder;
import heima3_2.cn.osc.base.MyBaseAdapter;
import heima3_2.cn.osc.model.bean.findbean.FriendBean;
import heima3_2.cn.osc.utils.Global;

/**
 * Created by yaozhanlie on 2017/1/13.
 */

public class AttentionHolder extends BaseHolder<FriendBean> {


    @Bind(R.id.iv_user)
    CircleImageView mIvUser;
    @Bind(R.id.tv_user_name)
    TextView mTvUserName;
    @Bind(R.id.iv_user_sex)
    ImageView mIvUserSex;
    @Bind(R.id.tv_user_from)
    TextView mTvUserCity;
    @Bind(R.id.tv_user_expertise)
    TextView mTvUserProfession;
    @Bind(R.id.ll_user_info)
    LinearLayout mLlUserInfo;
    private TextView mTextView;

    public AttentionHolder(Context context, ViewGroup parent, MyBaseAdapter<FriendBean> adapter, int position, FriendBean bean) {
        super(context, parent, adapter, position, bean);
    }

    @Override
    public View onCreateView(Context context, ViewGroup parent, int position, FriendBean bean) {
        View view = Global.inflats(R.layout.user_attention_item);
        ButterKnife.bind(this,view);
        return view;
    }

    @Override
    protected void onRefreshView(FriendBean bean, int position) {
        mTvUserName.setText(bean.getName());
        mTvUserCity.setText(bean.getFrom());
        Picasso.with(context).load(bean.getPortrait()).resize(50, 50).centerCrop().into(mIvUser);
        Picasso.with(context).load(bean.getGender()).resize(50, 50).centerCrop().into(mIvUserSex);
        mTvUserProfession.setText(bean.getExpertise());
    }
}


